Skip to content

Check both Supervisor takeover overrides#143

Open
driesvdv wants to merge 1 commit into
balena-io:mainfrom
driesvdv:fix/takeover-override-idempotency
Open

Check both Supervisor takeover overrides#143
driesvdv wants to merge 1 commit into
balena-io:mainfrom
driesvdv:fix/takeover-override-idempotency

Conversation

@driesvdv

@driesvdv driesvdv commented Jul 22, 2026

Copy link
Copy Markdown

Summary

  • check both legacy Supervisor takeover overrides
  • rerun takeover when either override is missing or does not match
  • allow the API endpoint override to be restored when Helios returns

Problem

Helios considered takeover complete when listenPortOverride alone matched. If apiEndpointOverride was removed while the listen-port override remained, Helios would not restore the API route through service-relay.

This complements the Supervisor recovery in balena-os/balena-supervisor#2536.

Testing

  • validated the embedded takeover script with Node's ES-module syntax checker
  • git diff --check

Copilot AI review requested due to automatic review settings July 22, 2026 11:28
@flowzone-app

flowzone-app Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

A repository maintainer needs to approve these workflow run(s).

To approve, maintainers can either:

Submit an approval review on this pull request, OR

Submit a review comment starting with /deploy

Then re-run the failed job(s) via the Checks tab above.

Reviews must be on the specific commit SHA of the workflow run to be considered.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the legacy supervisor takeover logic so Helios only considers takeover “already configured” when both supervisor DB overrides (apiEndpointOverride and listenPortOverride) match the expected values, ensuring the API route can be restored via service-relay when needed.

Changes:

  • Update the embedded takeover script to check both apiEndpointOverride and listenPortOverride before declaring idempotent success.
  • Adjust takeover config documentation to reflect that listenPortOverride is no longer treated as the sole idempotency key.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread helios-legacy/src/takeover.rs
Only treat a legacy Supervisor takeover as configured when both the API endpoint and listen-port overrides match. This lets Helios restore an API override cleared after an orphaned relay is detected.

Change-Type: patch
Signed-off-by: Dries Van de Velde <dries.vandevelde@c-battery.eu>
@driesvdv
driesvdv force-pushed the fix/takeover-override-idempotency branch from 7e1014e to 639a408 Compare July 22, 2026 11:39
@pipex

pipex commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Hi @driesvdv, thanks again for your contribution. The existing code looks only for the PORT_OVERRIDE variable because it is assumed that the supervisor has both overrides unless something tampered with the DB. That also keeps the injected script simple which is preferable since this is essentially a hack.

I see this assumption no longer holds with your supervisor PR. I've added some comments there and we can revisit this one once those are resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants